#include <bits/stdc++.h>

using namespace std;

void mergeSort(vector<int>& arr, int left, int right);

void merge(vector<int>& arr, int left, int mid, int right);

int main()
{
	int length; cin >> length;
	vector<int> arr;
	for (int i = 0, num; i < length; i++) {
		cin >> num;
		arr.push_back(num);
	}

	mergeSort(arr, 0, length);
	cout << arr[0];
	for (int i = 1; i < length; i++)
		cout << ' ' << arr[i];

	return 0;
}

int res;
vector<int> aux;
void mergeSort(vector<int>& arr, int left, int right)
{
	if (left + 1 == right) return;

	int  mid = left + (right - left >> 1);
	mergeSort(arr, left, mid);
	mergeSort(arr, mid, right);

	merge(arr, left, mid, right);
}

void merge(vector<int>& arr, int left, int mid, int right)
{
	aux.clear();
	int p_left = left, p_right = mid;
	while (p_left < mid && p_right < right)
		if (arr[p_left] <= arr[p_right])	aux.push_back(arr[p_left++]);
		else								{ aux.push_back(arr[p_right++]); res+=mid-p_left;}
	while (p_left < mid)	aux.push_back(arr[p_left++]);
	while (p_right < right) aux.push_back(arr[p_right++]);

	for (int i = left, j = 0; i < right; i++, j++)
		arr[i] = aux[j];
}
